package com.scott.spring.ch04;

import com.scott.spring.ch04.conf.AppConf;
import com.scott.spring.ch04.service.RoleService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author 黄后林
 * @version 1.0
 * @date 2021-12-14 09:40:55
 */
public class Ch04Test {

    public static void main(String[] args) {
        System.out.println("--------容器启动开始--------");
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConf.class);
        System.out.println("--------容器结束开始--------");


        // 拿2次、打印的是不同的对象、构造方法执行2次
        RoleService roleService = context.getBean(RoleService.class);
        System.out.println(roleService.add(10,20));

        System.out.println(roleService.getClass().getPackage());
    }
}
